package com.hissy.common.design.action.watcher;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by zhangyanfei on 2019/4/10.
 *
 * @author zhangyanfei
 * @date 2019/04/10
 */
public class Transport implements Watched {
    private List<Watcher> list = new ArrayList<>();

    @Override
    public void addWatcher(Watcher watcher) {
        list.add(watcher);
    }

    @Override
    public void removeWatcher(Watcher watcher) {
        list.remove(watcher);
    }

    @Override
    public void notifyAllWacthers() {
        for (Watcher watcher : list) {
            watcher.update();
        }
    }
}
